// 创建类组件rcc
import React, { Component } from 'react';
import Item from '../Item/Item';
import './List.css';
export default class List extends Component {
  render() {
    const { list, checkedChange, delTodoName, updateTodo } = this.props;
    return (
      <ul className="todo-main">
        {/* 遍历list的元素以取得每一项元素的内容,再通过标签属性props的方式,把内容传输到子组件Item上 */}
        {list.map((todo) => {
          return (
            <Item
              key={todo.id}
              todo={todo}
              checkedChange={checkedChange}
              delTodoName={delTodoName}
              updateTodo={updateTodo}
            ></Item>
          );
        })}
      </ul>
    );
  }
}
